No route matches [GET] "/user/sign_out"

Posted by user3399101 on Stack Overflow See other posts from Stack Overflow or by user3399101
Published on 2014-06-07T19:54:14Z Indexed on 2014/06/07 21:25 UTC
Read the original article Hit count: 217

So, I'm getting the below error when clicking on Sign Out on my drop down menu on the nav:

No route matches [GET] "/user/sign_out"

However, this only happens when using the sign out on the drop down nav (the hamburger menu for mobile devices) and not when clicking the sign out on the regular nav.

See the code below:

  <div class="container demo-5">
    <div class="main clearfix">
      <div class="column">
        <div id="dl-menu" class="dl-menuwrapper">
          <button class="dl-trigger">Open Menu</button>
          <ul class="dl-menu dl-menu-toggle">
            <div id="closebtn"  onclick="closebtn()"></div>
            <% if user_signed_in? %>
            <li><%= link_to 'FAQ', faq_path %></li>
            <li><a href="#">Contact Us</a></li>
            <li><%= link_to 'My Account', account_path %></li>                    
            <li><%= link_to 'Sign Out',  destroy_user_session_path, method: 'delete' %></li> <--- this is the line
            <% else %>
            <li><%= link_to 'FAQ', faq_path %></li>
            <li><a href="#">Contact Us</a></li>
            <li><%= link_to 'Sign In', new_user_session_path %></li>
            <li><%= link_to 'Free Trial', plans_path %></li>
            <% end %>
          </ul>
        </div><!-- /dl-menuwrapper -->
      </div>
    </div>
  </div><!-- /container -->
</div>

And this is the non-drop down code that works:

  <div class="signincontainer pull-right">
        <div class="navbar-form navbar-right">
          <% if user_signed_in? %>
            <%= link_to 'Sign out', destroy_user_session_path, class: 'btn signin-button', method: :delete %>
              <div class="btn signin-button usernamefont"><%= link_to current_user.full_name, account_path %></div>
          <% else %>
....rest of code here

Updated error:

ActionController::RoutingError (No route matches [GET] "/user/sign_out"):
  actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.4) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.0.4) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
  actionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/ru

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-4